
set(LIB_NAME QtXlsx)

set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

file(GLOB_RECURSE UTILS_SRC ${CMAKE_SOURCE_DIR}/xlsx/*.cpp)
file(GLOB_RECURSE UTILS_HDRS ${CMAKE_SOURCE_DIR}/xlsx/*.h)

include_directories(${CMAKE_CURRENT_BINARY_DIR})

QT6_WRAP_UI(UTILS_UIS_H ${UTILS_UIS})


add_library(QtXlsx SHARED ${UTILS_HDRS} ${UTILS_SRC} ${UTILS_UIS_H})

# require c++17
target_compile_features(QtXlsx PRIVATE cxx_std_17)

target_include_directories(QtXlsx SYSTEM PUBLIC
  ${${QT_VERSION_BASE}Core_INCLUDE_DIRS}
  ${${QT_VERSION_BASE}Gui_INCLUDE_DIRS}
  ${${QT_VERSION_BASE}Gui_PRIVATE_INCLUDE_DIRS}
  )

target_link_libraries(QtXlsx
  ${QWT_LIBRARY}
  Qt${QT_VERSION_MAJOR}::Core
  Qt${QT_VERSION_MAJOR}::Gui
  )

SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES AUTOMOC TRUE AUTOUIC TRUE AUTORCC TRUE ) #DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})

INSTALL(
		TARGETS ${LIB_NAME}
		RUNTIME DESTINATION bin
		LIBRARY DESTINATION bin
		ARCHIVE DESTINATION lib
	)

INSTALL(
		FILES       ${UTILS_SRC}
		DESTINATION include
	)
